#include "myFILE.h"
#include <stdio.h>

int main()
{
  FILE_ *fp = fopen_("./file.txt", "w");
  if (fp == NULL)
  {
    return 1;
  }
  int cnt = 5;
  const char *msg = "hello world "; 
  // const char *msg = "hello world\n";//file.txt中刷新的策略不一样
  while (1)
  {
    fwrite_(msg, strlen(msg), fp);
    // fflush_(fp);//这样没带\n也刷 --> 强制刷新

    sleep(1);
    printf("count: %d\n", cnt);
    // if(cnt == 5) fflush_(fp);
    cnt--;
    if (cnt == 0)
      break;
  }
  fclose_(fp);
  return 0;
}